package com.itheima.treeset.demo1;

import java.util.Collections;
import java.util.TreeSet;

public class Demo1 {
    public static void main(String[] args) {
        TreeSet<Student> set=new TreeSet<>();
        Student stu1 = new Student("张三", 23);
        Student stu2 = new Student("张四", 28);
        Student stu3 = new Student("张五", 25);
        set.add(stu1);
        set.add(stu2);
        set.add(stu3);

        for (Student student : set) {
            System.out.println(student);
        }

    }
}
